#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests

def getweather():
    r = requests.get("https://api.thinkpage.cn/v3/weather/now.json?key=dgm5vnlh5aszoifb&location=nanjing")
    p = r.json()['results'][0]['now']
    return p
# {"sk_info":{"date":"20131012","cityName":"南京","areaID":"101190101","temp":"26℃","tempF":"78.8℉",
# "wd":"东南风","ws":"4级","sd":"34%","time":"15:10","sm":"暂无实况"}}
if __name__ == '__main__':
    p = getweather()
    # print p
    print u"南京今日天气"
    print u"%s" % p['text']
    print u"气温: %s" % p['temperature']